package com.charlotte.study.gupao.iterator.course;

import java.util.List;

/**
 * @author junjie.ding
 * @date 2020/3/16
 */
public class CourseAggregateImpl implements CourseAggregate {

    private List<Course> list;

    public CourseAggregateImpl(List<Course> list) {
        this.list = list;
    }

    @Override
    public boolean add(Course course) {
        return this.list.add(course);
    }

    @Override
    public boolean remove(Course course) {
        return this.list.remove(course);
    }

    @Override
    public Iterator<Course> iterator() {
        return new IteratorImpl<>(list);
    }
}
